<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ins1st cloud v1.0 | 很赞的SpringCloud分布式系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${ctxPath}/static/css/oksub.css" media="all"/>
    <link rel="stylesheet" href="${ctxPath}/static/css/my_info.css" media="all"/>
</head>
<body class="console console1 ok-body-scroll">
<div class="ok-body home">
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <!-- 左 -->
            <div class="layui-col-sm12 layui-col-md3">
                <div class="layui-card">
                    <div class="layui-card-body" style="padding: 25px;">
                        <div class="text-center layui-text">
                            <div class="user-info-head" id="imgHead">
                                <img id="avatarPreview"
                                     src="${shiro.getUser().userImage!}"/>
                            </div>
                            <h2 style="padding-top: 20px;">${shiro.getUser().userNick}</h2>
                            <p style="padding-top: 8px;">超级管理员 开发部</p>
                        </div>
                        <div class="layui-text" style="padding-top: 30px;">
                            <div class="info-list-item">
                                <i class="layui-icon layui-icon-notice"></i>
                                <p>${shiro.getUser().userEmail}</p>
                            </div>

                            <div class="info-list-item">
                                <i class="layui-icon layui-icon-cellphone"></i>
                                <p>${shiro.getUser().userMobile}</p>
                            </div>
                            <div class="info-list-item">
                                <i class="layui-icon layui-icon-location"></i>
                                <p>中国 XX市 XX区 XXX街道 XXX号</p>
                            </div>
                        </div>
                        <div class="dash"></div>
                        <h3>标签</h3>
                        <div class="layui-badge-list" style="padding-top: 6px;">
                            <span class="layui-badge layui-bg-gray">INS1ST</span>
                            <span class="layui-badge layui-bg-gray">INS1ST CLOUD</span>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 右 -->
            <div class="layui-col-sm12 layui-col-md9">
                <div class="layui-card">
                    <div class="layui-card-body layui-text">

                        <div class="layui-tab layui-tab-brief" lay-filter="userInfoTab">
                            <ul class="layui-tab-title">
                                <li class="layui-this">基本信息</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-form layui-tab-item layui-show" lay-filter="userInfoForm">
                                    <input type="hidden" name="userId"/>
                                    <div class="layui-form user-info-form" style="max-width: 400px;padding-top: 25px;">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">账号:</label>
                                            <div class="layui-input-block">
                                                <input type="hidden" id="id" name="id" value="${shiro.getUser().id}"/>
                                                <input type="text" name="userName" class="layui-input layui-disabled"
                                                       lay-verify="required" disabled
                                                       value="${shiro.getUser().userName}"/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">姓名:<span
                                                    style="color: red;">*</span></label>
                                            <div class="layui-input-block">
                                                <input type="text" name="userNick" class="layui-input"
                                                       lay-verify="required"
                                                       required value="${shiro.getUser().userNick}"/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">性别:</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="userSex" value="1" title="男"
                                                       @if(shiro.getUser().userSex== '1'){
                                                checked
                                                @}
                                                >
                                                <input type="radio" name="userSex" value="2" title="女"
                                                       @if(shiro.getUser().userSex== '2'){
                                                checked
                                                @}
                                                >
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">邮箱:<span
                                                    style="color: red;">*</span></label>
                                            <div class="layui-input-block">
                                                <input type="email" name="userEmail" class="layui-input"
                                                       lay-verify="required|email" required
                                                       value="${shiro.getUser().userEmail}"/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">联系电话:</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="userMobile" class="layui-input"
                                                       lay-verify="required"
                                                       required value="${shiro.getUser().userMobile}"/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-filter="update" lay-submit>
                                                    更新基本信息
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script src="${ctxPath}/static/lib/layui/layui.js"></script>
<script src="${ctxPath}/static/lib/ztree/js/jquery-1.4.4.min.js"></script>
<script src="${ctxPath}/static/js/ins1st.js"></script>
<script>
    layui.use(['form', 'ax', 'upload'], function () {

        let form = layui.form;
        let $ax = layui.ax;
        let upload = layui.upload;

        upload.render({
            elem: '#imgHead'
            , url: '${ctxPath}/sys/user/uploadImage'
            , done: function (res) {
                if (res.success) {
                    admin.success("上传成功", function () {
                        $("#avatarPreview").attr("src",res.data.showUrl);
                    });
                }
            }
            , error: function () {
                //请求异常回调
            }
        });

        form.on("submit(update)", function (data) {
            var ax = new $ax(ctx + "/sys/user/insertOrUpdate", function (result) {
                admin.success(result.message, function () {
                    window.location.href = "${ctxPath}/sys/user/myInfo";
                });
            });
            ax.postForm(data.field);
            ax.start();
            return false;
        });
    });
</script>
